package firstjob;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class LocalTestWithUi {

	public static void main(String[] args) throws Exception {
		Configuration conf = new Configuration();
//		conf.setInteger("rest.port", 1111);
		StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(conf);
		DataStreamSource<String> source = env.socketTextStream("localhost", 4444);
		source.map(new MapFunction<String, Integer>() {
			@Override
			public Integer map(String s) throws Exception {
				return Integer.parseInt(s) * 2;
			}
		}).print();
		env.execute();
	}
}
